Skip to content

Feat: rename oversized containers from their edit form - #1248

Open
Rom1-B wants to merge 11 commits into
mainfrom
support_45901
Open

Rom1-B wants to merge 11 commits into
mainfrom
support_45901

Conversation

@Rom1-B

@Rom1-B Rom1-B commented Aug 21, 2026

Copy link
Copy Markdown
Contributor

Checklist before requesting a review

Please delete options that are not relevant.

  • I have performed a self-review of my code.
  • I have added tests (when available) that prove my fix is effective or that my feature works.
  • I have updated the CHANGELOG with a short functional description of the fix or new feature.
  • This change requires a documentation update.

Description

  • It fixes !45901
  • When a container's computed table name exceeds MySQL's 64-character limit, the plugin now disables it instead of crashing, and shows a rename form directly on the container's edit page.
  • Submitting a shorter name renames the container and reactivates it; if a table with matching data already exists under that name (e.g. after a version migration), its data is preserved instead of being replaced by an empty table.
  • plugins:fields:check_database now also reports container/item type pairs with no matching table, and tables with no matching container/item type pair.

Screenshots (if appropriate):

Comment thread inc/checkdatabasecommand.class.php
Comment thread inc/checkdatabasecommand.class.php
Comment thread inc/container.class.php
@Rom1-B
Rom1-B requested a review from stonebuzz August 24, 2026 09:56
@Rom1-B
Rom1-B requested review from Otijom and removed request for Otijom September 17, 2026 12:38
@Rom1-B
Rom1-B force-pushed the support_45901 branch 2 times, most recently from 96320bf to 1f9fcbe Compare September 22, 2026 11:17
Comment thread tests/Units/ContainerTest.php
Comment thread inc/container.class.php Outdated
Comment thread inc/container.class.php Outdated
Comment thread inc/container.class.php
@Rom1-B
Rom1-B requested a review from RomainLvr September 25, 2026 13:50
Comment thread inc/container.class.php Outdated
Comment thread inc/container.class.php
Comment thread inc/container.class.php Outdated
@stonebuzz

Copy link
Copy Markdown
Contributor

@Rom1-B can you rebase ?

@stonebuzz

Copy link
Copy Markdown
Contributor

CI failed

@Rom1-B
Rom1-B force-pushed the support_45901 branch 2 times, most recently from 4d0beaa to 9026f8a Compare October 12, 2026 09:54
@Rom1-B
Rom1-B force-pushed the support_45901 branch 2 times, most recently from 57ea76d to d2a0ec0 Compare October 14, 2026 12:49

@MyvTsv MyvTsv left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the user should not be able to reactivate a container that has been inactive for too long, in order to avoid potential errors caused by its reactivation.

Image

@Rom1-B
Rom1-B requested a review from MyvTsv October 20, 2026 11:28
Comment thread inc/container.class.php Outdated
Comment on lines +1096 to +1102
$toolbox = new PluginFieldsToolbox();
$new_name = $toolbox->getSystemNameFromLabel($new_name);
if ($new_name === '') {
Session::AddMessageAfterRedirect(__('Invalid name.', 'fields'), false, ERROR);

return false;
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PluginFieldsToolbox::getSystemNameFromLabel() never returns an empty string: for an empty or non-alphanumeric label it falls back to random_int() converted to letters. Submitting the rename form with a blank field therefore renames the container to a random string and reactivates it, and this guard is dead code. Validate the raw input before transforming it.

    if (trim($new_name) === '') {
        Session::AddMessageAfterRedirect(__('Invalid name.', 'fields'), false, ERROR);
        return false;
    }
    $new_name = $toolbox->getSystemNameFromLabel($new_name);

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

@Rom1-B
Rom1-B requested a review from stonebuzz October 22, 2026 10:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants